package com.ruoyi.framework.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitMQConfig {

    @Bean
    public Queue callBackD() {
        return new Queue("callBackD", true);
    }

/*    @Bean
    public Queue queueB() {
        return new Queue("helloB", true);
    }

    @Bean
    public Queue queueC() {
        return new Queue("helloC", true);
    }*/

    //创建一个fanoutExchange交换机
    @Bean
    FanoutExchange fanoutExchange() {
        return new FanoutExchange("fanoutExchange");
    }

    //将queueA队列绑定到fanoutExchange交换机上面
    @Bean
    Binding bindingExchangeMessageFanoutA(Queue callBackD, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(callBackD).to(fanoutExchange);
    }

    /*//将queueB队列绑定到fanoutExchange交换机上面
    @Bean
    Binding bindingExchangeMessageFanoutB(Queue queueB, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(queueB).to(fanoutExchange);
    }

    @Bean
    Binding bindingExchangeMessageFanoutC(Queue queueC, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(queueC).to(fanoutExchange);
    }
*/
}
